using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class PKT_AcctTransMap : EntityTypeConfiguration<PKT_AcctTrans>
    {
        public PKT_AcctTransMap()
        {
            // Primary Key
            this.HasKey(t => new { t.spid, t.id });

            // Properties
            this.Property(t => t.spid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Acct)
                .HasMaxLength(40);

            this.Property(t => t.Period)
                .HasMaxLength(4);

            this.Property(t => t.Batch)
                .HasMaxLength(8);

            this.Property(t => t.Desc)
                .HasMaxLength(130);

            this.Property(t => t.TransType)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PKT_AcctTrans");
            this.Property(t => t.spid).HasColumnName("spid");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Acct).HasColumnName("Acct");
            this.Property(t => t.CstCtrID).HasColumnName("CstCtrID");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Period).HasColumnName("Period");
            this.Property(t => t.Batch).HasColumnName("Batch");
            this.Property(t => t.BatchID).HasColumnName("BatchID");
            this.Property(t => t.Desc).HasColumnName("Desc");
            this.Property(t => t.DueDate).HasColumnName("DueDate");
            this.Property(t => t.DebitAcct).HasColumnName("DebitAcct");
            this.Property(t => t.DebitBase1).HasColumnName("DebitBase1");
            this.Property(t => t.DebitBase2).HasColumnName("DebitBase2");
            this.Property(t => t.CreditAcct).HasColumnName("CreditAcct");
            this.Property(t => t.CreditBase1).HasColumnName("CreditBase1");
            this.Property(t => t.CreditBase2).HasColumnName("CreditBase2");
            this.Property(t => t.TransType).HasColumnName("TransType");
        }
    }
}
